import { ObjCreate } from "../../common/ObjCreate";
import { TitleItem } from "../../common/item/TitleItem";
import { Language } from "../../../../../extend/language/Language";
import { ObjTeamCreate } from "../../common/ObjTeamCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { TilePanel } from "../../equipment/TilePanel";
import { ArenaCrossTopListCellRenderer2 } from "../cellRenderer/ArenaCrossTopListCellRenderer2";
import { PageSelecter } from "../../common/pageSelect/PageSelecter";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { ArenaCrossGetListData } from "../arenaCrossData/ArenaCrossGetListData";
import { EArenaProcess } from "../../../../../Message/Public/EArenaProcess";
import { SArenaCrossToplists } from "../../../../../Message/Public/SArenaCrossToplists";
import { SArenaCrossToplist } from "../../../../../Message/Public/SArenaCrossToplist";
import { EArenaOutLine } from "../../../../../Message/Public/EArenaOutLine";
import { DataProvider } from "../../../../../fl/data/DataProvider";
type int = number;
//class ArenaCrossGroupSeaResultPanel
    
    export  class ArenaCrossGroupSeaResultPanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createSpBannerAndBg(0, 0, 802, 450, "", this);
            var loc1=new Vector.<TitleItem>();
            loc1.push(new TitleItem(Language.getString(44241), 60));
            loc1.push(new TitleItem(Language.getString(44242), 180));
            loc1.push(new TitleItem(Language.getString(44243), 60));
            loc1.push(new TitleItem(Language.getString(44244), 60));
            loc1.push(new TitleItem(Language.getString(44245), 70));
            loc1.push(new TitleItem(Language.getString(44246), 70));
            loc1.push(new TitleItem(Language.getString(44247), 70));
            loc1.push(new TitleItem(Language.getString(44248), 70));
            loc1.push(new TitleItem(Language.getString(44249), 80));
            loc1.push(new TitleItem(Language.getString(44292), 80));
            var loc2=ObjTeamCreate.createTitles(loc1);
            ObjCreate.setObjAttri(loc2, 2, 8, -1, -1, this);
            this._tfNoResult = ObjCreate.createTextField(Language.getString(44251), 374, 210, 200, 20, this, GlobalStyle.textFormat6);
            this._tfNoResult.visible = false;
            this._topListPanel = new TilePanel();
            this._topListPanel.setSize(802, 420);
            this._topListPanel.rowHeight = 42;
            this._topListPanel.columnWidth = 802;
            this._topListPanel.setStyle("cellRenderer", ArenaCrossTopListCellRenderer2);
            this._topListPanel.x = 5;
            this._topListPanel.y = 30;
            this.addChild(this._topListPanel);
            this._pageSelecter = new PageSelecter();
            this._pageSelecter.mode = PageSelecter.InputMode;
            this._pageSelecter.x = 272;
            this._pageSelecter.y = 458;
            this._pageSelecter.pageTextBoxSize = 50;
            this.addChild(this._pageSelecter);
            this._pageSelecter.addEventListener(flash.events.Event.CHANGE, this.onChange);
            this.addEventListener(flash.events.Event.ADDED_TO_STAGE, this.onAddToStage);
            return;
        }

        /* internal  */onAddToStage(arg1: Object /* flash.events.Event */): void
        {
            this.getList();
            return;
        }

        /* internal  */onChange(arg1: Object /* flash.events.Event */): void
        {
            this.getList();
            return;
        }

        /* internal  */getList(): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaCrossGetArenaLists, new ArenaCrossGetListData(EArenaProcess._EArenaElimination4, this._pageSelecter.currentPage, this.pageSize, false, true)));
            return;
        }

        public updateArenaCrossTopList(arg1: SArenaCrossToplists): void
        {
            this._arenaCrossTopLists = arg1;
            this._pageSelecter.maxPage = arg1.pageNum;
            this.updateList();
            this.updateVisible();
            return;
        }

        /* internal  */updateList(): void
        {
            var loc3=null;
            var loc1=new Array<any>();
            var loc2=0;
            while (loc2 < this._arenaCrossTopLists.toplists.length) 
            {
                loc3 = this._arenaCrossTopLists.toplists[loc2] as SArenaCrossToplist;
                if (loc3.outLine.value() == EArenaOutLine._EArenaOutLineYes) 
                {
                    loc1.push(loc3);
                }
                ++loc2;
            }
            this._topListPanel.dataProvider = new DataProvider(loc1);
            this._topListPanel.drawNow();
            return;
        }

        /* internal  */updateVisible(): void
        {
            var loc1=this._arenaCrossTopLists && this._arenaCrossTopLists.toplists.length > 0;
            this._topListPanel.visible = loc1;
            this._tfNoResult.visible = !loc1;
            return;
        }

        /* internal */ /* const */pageSize: int=10;

        /* internal */ /* var */_process: int;

        /* internal */ /* var */_tfNoResult: Object /* flash.text.TextField */;

        /* internal */ /* var */_topListPanel: TilePanel;

        /* internal */ /* var */_pageSelecter: PageSelecter;

        /* internal */ /* var */_arenaCrossTopLists: SArenaCrossToplists;
    }
